import axios from 'axios'

// 创建请求
const server = axios.create({
    // baseURL: '/api/v1',
    timeout: 50000
})


// 请求发送前
server.interceptors.request.use(
    (config) => {
        config['token'] = localStorage.getItem('token')
        return config
    },
    (error) => {
        return Promise.reject(error)
    }
)

// 请求发送后
server.interceptors.response.use(
    (response) => {
        // console.log(response);
        // const res = response.data


        return response
    },
    (error) => {
        return Promise.reject(error)
    }
)

export default server